From: Marco Trevisan (TreviƱo) Date: Sat, 31 Aug 2019 18:43:05 +0000 (+0200) Subject: calendar: Use binding for clearButton visibility X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~811^2^2~160 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=27da3ed1fec700cedd3735241c5160e85bbc5383;p=gnome-shell.git calendar: Use binding for clearButton visibility When the calendar PlaceHolder is visible, the ClearButton shouldn't be. Instead of setting the visibility explicitly, we can use a property binding. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/700 --- diff --git a/js/ui/calendar.js b/js/ui/calendar.js index 2a4214e60..4de3965ac 100644 --- a/js/ui/calendar.js +++ b/js/ui/calendar.js @@ -1,7 +1,7 @@ // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- /* exported Calendar, CalendarMessageList */ -const { Clutter, Gio, GLib, Shell, St } = imports.gi; +const { Clutter, Gio, GLib, GObject, Shell, St } = imports.gi; const Signals = imports.signals; const Main = imports.ui.main; @@ -1075,6 +1075,10 @@ var CalendarMessageList = class CalendarMessageList { }); box.add_actor(this._clearButton); + this._placeholder.actor.bind_property('visible', + this._clearButton, 'visible', + GObject.BindingFlags.INVERT_BOOLEAN); + this._sectionList = new St.BoxLayout({ style_class: 'message-list-sections', vertical: true, y_expand: true, @@ -1145,7 +1149,6 @@ var CalendarMessageList = class CalendarMessageList { let empty = sections.every(s => s.empty || !s.actor.visible); this._placeholder.actor.visible = empty; - this._clearButton.visible = !empty; let canClear = sections.some(s => s.canClear && s.actor.visible); this._clearButton.reactive = canClear;